import java.util.ArrayList;


public abstract class Node {
	protected ArrayList<Node> children = new ArrayList<Node>();
	Node parent = null;
	
	int order;
	int size;//number of children below you
	
	int getSize(){
		return 1+size;//you+size
	}
	
	void updateSize(){
		Node n = this;
		while (n != null) {
			if (n.parent == n) {
//				System.out.println("Here");
			}
			n.size = 0;
			
			for (Node child : n.children) {
				n.size += child.getSize();
			}
			
			n = n.parent;
		}
	}
	
	abstract double evaluate(double [] v);
	
	abstract Node deepCopy();
	
	abstract public String toString();
}
